package com.sc.nft.entity.vo.ecology;


import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sc.nft.enums.ReceivedCollectionType;
import com.sc.nft.enums.UserEcologyHatchCollectionTypeRecordsEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class AdminEcologyRecycleRecordsVO {

    @ApiModelProperty(value = "藏品名称")
    private String collectionName;

    @ApiModelProperty(value = "藏品编号")
    private String numbering;

    @ApiModelProperty(value = "用户账号")
    private String userTel;

    @ApiModelProperty(value = "回收来源")
    private ReceivedCollectionType type;

    @ApiModelProperty(value = "藏品状态 RECYCLE:回收 DESTROY:销毁")
    private UserEcologyHatchCollectionTypeRecordsEnum collectionStatus;

    @ApiModelProperty(value = "回收来源名称")
    private String typeName;

    @ApiModelProperty(value = "购买价")
    private String buyPrice;

    @ApiModelProperty(value = "时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;


    public void setBuyPrice(BigDecimal buyPrice) {
        this.buyPrice = buyPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
    }

    public void setType(ReceivedCollectionType type) {
        this.type = type;
        if(ObjectUtil.isNotNull(type)){
            this.typeName = type.getDescription();
        }
    }
}
